/*
 * @作者: kerwin
 * @公众号: 大前端私房菜
 */
var express = require("express");
const UserController = require("../../controllers/admin/UserController");
var UserRouter = express.Router();
//图片上传
const multer = require("multer");
const upload = multer({ dest: "public/avataruploads/" });

/* GET home page. */
//登录接口
UserRouter.post("/adminapi/user/login", UserController.login);
//更新个人中心
UserRouter.post(
  "/adminapi/user/upload",
  upload.single("file"),
  UserController.upload
);
//用户列表 增删改查
//添加用户
UserRouter.post(
  "/adminapi/user/add",
  upload.single("file"),
  UserController.add
);
//查询所有用户列表
UserRouter.get("/adminapi/user/list", UserController.getList);
//查询单个用户
UserRouter.get("/adminapi/user/list/:id", UserController.getList);
//删除用户
UserRouter.delete("/adminapi/user/list/:id", UserController.delList);
//更新用户
UserRouter.put("/adminapi/user/list/:id", UserController.putList);

module.exports = UserRouter;
